{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import math"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 固定参数（高斯单位制）\n",
    "k = 1.3806509*(10**(-16))  # erg/K\n",
    "m_e = 0.91093835*(10**(-27))  # g\n",
    "e = 4.803203*(10**(-10))  # CGS\n",
    "c = 2.99792458*(10**10)  # cm/s\n",
    "h = 6.624*(10**(-27))  # erg s  \n",
    "\n",
    "# 1eV = 1.6022*(10**(-12))erg = 1.6022*(10**(-19))J"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.29544321725283723\n"
     ]
    }
   ],
   "source": [
    "# 萨哈方程\n",
    "\n",
    "N_e = 10**14  # cm^-3\n",
    "T = 5000  # K\n",
    "x_1 = 7.9  # eV\n",
    "U_1 = 26.9\n",
    "U_2 = 42.7\n",
    "\n",
    "N_2_div_N_1 = (1/N_e) * (2*U_2/U_1) * ((2*math.pi*m_e*k*T)**1.5)/(h**3) * math.exp(-x_1/(k*T/(1.6022*(10**(-12)))))\n",
    "print (N_2_div_N_1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-0.152\n"
     ]
    }
   ],
   "source": [
    "# 大多数处于中性元素的中性谱线\n",
    "\n",
    "Delta_T = 1000  # K\n",
    "T = 5000  # K\n",
    "x = 0  # eV  （激发电势）\n",
    "\n",
    "Delta_W_div_W = Delta_T * ((2.5/T)+(1.16*(10**4)*(x+0.75)/(T**2))-0.001)\n",
    "print (Delta_W_div_W)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-0.4989450000000001\n"
     ]
    }
   ],
   "source": [
    "# 大多数处于离子元素的中性谱线\n",
    "\n",
    "Delta_T = 333  # K\n",
    "T = 6000  # K\n",
    "x = 0  # eV  （激发电势）\n",
    "I = 5.4  # eV  （电离势）\n",
    "\n",
    "Delta_W_div_W = Delta_T * (1.16*(10**4)*(x+0.75-I)/(T**2))\n",
    "print (Delta_W_div_W)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.40661728395061725\n"
     ]
    }
   ],
   "source": [
    "# 大多数处于中性元素的离子谱线\n",
    "\n",
    "Delta_T = 100  # K\n",
    "T = 4500  # K\n",
    "x = 0  # eV  （激发电势）\n",
    "I = 7.9  # eV  （电离势）\n",
    "\n",
    "Delta_W_div_W = Delta_T * ((5/T)+(1.16*(10**4)*(x+0.75+I)/(T**2))-0.002)\n",
    "print (Delta_W_div_W)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-0.152\n"
     ]
    }
   ],
   "source": [
    "# 大多数处于离子元素的离子谱线\n",
    "\n",
    "Delta_T = 1000  # K\n",
    "T = 5000  # K\n",
    "x = 0  # eV  （激发电势）\n",
    "\n",
    "Delta_W_div_W = Delta_T * ((2.5/T)+(1.16*(10**4)*(x+0.75)/(T**2))-0.001)\n",
    "print (Delta_W_div_W)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
